Skip to main content

upgrade the project

"@angular/animations": "18.1.1", "@angular/cdk": "18.1.1", "@nestjs/core": "^10.3.8", "@nx/angular": "19.5.1", "@nx/cypress": "19.5.1",

anyways

Revert package.json, package-lock.json, migrations.json to master

Clean node_modules to avoid corrupted state

Install dependencies with original package.json

Run pending Nx 19 migrations

Upgrade Nx 19 → 20 (Angular 18 → 19)

Install dependencies and run migrations for Nx 20

Upgrade Nx 20 → 21 (Angular 19 → 20)

Install dependencies and run migrations for Nx 21

Upgrade Nx 21 → 22 (Angular 20 → 21)

Install dependencies and run migrations for Nx 22

This is the recommended steps to do

现在清楚了。你用了 nx migrate latest 一次性从 Nx 19 → 22,跳了 3 个大版本。migrations.json 里有 40+ 个待执行的迁移,从 19.6 一路到 22.3。

这就是问题所在。Nx 官方建议每次只升一个大版本,不能一步跳三级。npm install 卡住很可能是因为这么多互相冲突的依赖无法正确解析。

建议方案:回退,然后分步升级